#include<stdio.h>
int main()
{
    int queue[105];
    freopen("in.txt","r",stdin);
    int m,n;
    scanf("%d %d",&m,&n);
    int front = 0;
    int rear = 0;
    int count = 0;
    for(int i = 0; i < n; i++)
    {
        //for(int k = front; (rear+1) % (m+1) != front; front = (front+1) % (m+1))
        //{
        //    printf("%d",queue[k+1]);
        //}
        int a;
        scanf("%d",&a);
        int j = front;
        int flag = 0;
        while ((rear+1) % (m+1) != (j+1) % (m+1)  && rear != front)
        {
            if(queue[(j+1)%(m+1)] == a)
            {
                flag = 1;
                break;
            }
            j++;
        }
        if(!flag)
        {
            count++;
            if((rear+1) % (m+1) == front)
            {
                front = (front + 1) % (m+1);
                rear = (rear + 1) % (m+1);
                queue[rear] = a;
            }
            else
            {
                rear = (rear+1) % (m+1);
                queue[rear] = a;
            }
        }
    }
    printf("%d",count);
}